


function load_menu(){

    var api_web_service = ADMIN_APPLICATIONS.get_api_web_service('Routines/HOME_MENUS_SERVICE');

    $.postJSON(''+api_web_service, {}, {},function(obj){

        var datalist = obj;

        for(var i=0;i<datalist.length;i++){
            var header_info = obj[i];
            if(header_info.menu_classId=="0"){
                var _nav_header = '<li class="nav-header">'+header_info.menu_name+'</li>';
                _nav_header = _nav_header + _load_menu(obj,header_info.menu_id)

                $('.thesidebar').append(_nav_header);
            }
        }

    });



}

function _load_menu(list,menu_id) {

    var _nav_header = "";
    for (var n = 0; n < list.length; n++) {
        var _nav_item_info = list[n];
        if (_nav_item_info.menu_classId == menu_id) {

            var style_info = $.parseJSON(_nav_item_info.menu_style);
            //alert(style_info)

            var _nav_item = '<li class="nav-item">\n' +
                '<a href="'+_nav_item_info.menu_url+'" class="nav-link">\n' +
                '<i class="nav-icon '+style_info.icon+'"></i>   <p>' + _nav_item_info.menu_name + '</p>\n' +
                '</a>\n' +
                '</li>';
            _nav_header = _nav_header + _nav_item;
        }
    }
    return _nav_header;
}

